<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset={$defaultCharset|escape}" />
	<link rel="stylesheet" href="{$baseUrl}/lib/pkp/styles/pkp.css" type="text/css" />
	

	<link rel="stylesheet" href="{$baseUrl}/lib/pkp/styles/common.css" type="text/css" />
	<link rel="stylesheet" href="{$baseUrl}/styles/common.css" type="text/css" />

	<link rel="stylesheet" type="text/css" href="{$baseUrl}/styles/dm.css">


	<!-- Base Jquery -->
	{*
	{if $allowCDN}<script type="text/javascript" src="http://www.google.com/jsapi"></script>
	<script type="text/javascript">{literal}
		// Provide a local fallback if the CDN cannot be reached
		if (typeof google == 'undefined') {
			document.write(unescape("%3Cscript src='{/literal}{$baseUrl}{literal}/lib/pkp/js/lib/jquery/jquery.min.js' type='text/javascript'%3E%3C/script%3E"));
			document.write(unescape("%3Cscript src='{/literal}{$baseUrl}{literal}/lib/pkp/js/lib/jquery/plugins/jqueryUi.min.js' type='text/javascript'%3E%3C/script%3E"));
		} else {
			google.load("jquery", "{/literal}{$smarty.const.CDN_JQUERY_VERSION}{literal}");
			google.load("jqueryui", "{/literal}{$smarty.const.CDN_JQUERY_UI_VERSION}{literal}");
		}
	{/literal}</script>
	{else}
	*}
	<script type="text/javascript" src="{$baseUrl}/lib/pkp/js/lib/jquery/jquery.min.js"></script>
	<script type="text/javascript" src="{$baseUrl}/lib/pkp/js/lib/jquery/plugins/jqueryUi.min.js"></script>
	{*{/if}
	*}

	<script type="text/javascript" src="{$baseUrl}/classes/acct/js/danhmuc.js?V1"></script>

</head>


{strip}
{assign var="pageTitle" value="Danh muc Tai Khoan"}
{assign var="socot" value="4"}
{include file="acct/acctNavbar.tpl"}
{include file="acct/breadcrumbs.tpl"}
{url|assign:"InsUrl" op="DMTK_Ins"}
{/strip}

{assign var="matk" value=""}
{assign var="tentk" value=""}

<div id = "search" style= "text-align: center; padding: 10px 20px ; width:100%; color: #458B74" >
<strong style="font-size: 2em;" >DANH MỤC TÀI KHOẢN</strong>
	
<form method="post" action="{url page='acctKT' op='KT_DANHMUC' ChiTiet = 'TK'}">
	&nbsp;&nbsp;&nbsp;
	<br>
	<br>
	<select name="searchField" size="1" class="selectMenu">
		{html_options options=$fieldOptions selected=$searchField}
	</select>
	<select name="searchMatch" size="1" class="selectMenu">
		<option value="contains"{if $searchMatch == 'contains'} selected="selected"{/if}>C&#243; ch&#7913;a</option>
		<option value="is"{if $searchMatch == 'is'} selected="selected"{/if}>L&#224;</option>
		<option value="startsWith"{if $searchMatch == 'startsWith'} selected="selected"{/if}>B&#7855;t &#273;&#7847;u l&#224; </option>
	</select>

	<input type="text" size="10" name="search" class="textField" value="{$search|escape}" />&nbsp;<input type="submit" value="{translate key="common.search"}" class="button" />
</form>
</div>
<br>
<br>


<div id = "create" style="display: none; width:80%;  margin-left: auto; margin-right: auto;">
	<table width="100%" style = " border: thin black solid;">
	<tr valign="bottom" height = "40px">
	<td colspan = "2" id = "create_title" width="100%" style = "text-align: center; padding: 0 ; width:100%; color: #458B74;font-size: 1.2em; font-weight: bold; border-width: 0;" > Thêm Tài khoản mới </td>
	</tr>

	<tr valign="top" height = "1px">
		<td colspan = "2">
		<hr size="1" width="30%" noshade style="color:#000000" align="center" />
		</td>
	</td>
	<tr height = "5px">
	</tr>


	<tr valign="top">
		<td></td>
		<td width="20%" class="label" style = "text-align: left;">
		<input type="checkbox" name="ngoaibang"  id="ngoaibang" value="1" class="textField" />
		<label for="ngoaibang">Tài khoản ngoài bảng&nbsp</label>
		</td>
	</tr>

	<tr valign="top">
		<td width="20%" class="label" style = "text-align: right;"><label for="matk">M&#227; T&#224;i Kho&#7843;n: &nbsp</label></td>
		<td width="80%" class="value"><input type="text" name="matk" value="{$matk}" id="matk" size="40" maxlength="70" style="text-transform:uppercase" class="textField" /></td>
	</tr>

	<tr valign="top">
		<td width="20%" class="label" style = "text-align: right;"><label for="tentk">T&#234;n T&#224;i kho&#7843;n:&nbsp</label></td>
		<td width="80%" class="value"><input type="text" name="tentk" value="{$tentk}" id="tentk" size="40" style="width:70%" class="textField" /></td>
	</tr>
			
	<tr valign="top">
		<td width="20%" class="label" style = "text-align: right;"></td>
		<td width="80%" class="value">
		<input type="checkbox" name="tieu_khoan"  id="tieu_khoan" value="1" class="textField" /> 
		<label for="tieu_khoan">Tiểu khoản &nbsp</label>
		<label for="tk_me">- &nbsp Tài khoản mẹ: </label>
		<input type="text" name="tk_me" id="tk_me" size="20"  class="textField" />
		</td>
	</tr>




	<tr valign="top">
	</tr>

	<tr valign="top" height = "40px">
	<td colspan = "2" width="100%" style = "text-align: center; padding: 10px 20px ; width:100%; color: #458B74;font-weight: bold;"> 
	<input type="button" id = "createbutton" value="Thêm mới" class="button defaultButton" onclick="SaveDMTK('{$InsUrl}');" /> <input type="button" value="{translate key="common.cancel"}" class="button defaultButton" onclick="RTFcreate();" />
	</td></tr>

	</table>
	<br>
	<br>
</div> 

<table width = "100%">
<tr>
<td width = "50%">
	<div id = "btnThem"> 
	<input type="button" id="button_id" value="Th&#234;m T&#224;i kho&#7843;n"  class="button" style= "text-align: left;"  onClick="create();"> 
	</div>
</td>
<td width = "50%" style= "text-align: right; 	font-weight: bold;">
<label >{$searchSql}</label>
<a href="{url page="acctKT" op="KT_DANHMUC" ChiTiet = "TK"}" class="action">Đọc lại dữ liệu</a> <br>
(Nếu dữ liệu có thêm hay sửa- <br>hãy đọc lại để có danh sách mới nhất)
</td>
</tr>
</table>

<div id="sections">

<table width="100%" id="customers">
	<tr valign="bottom">
		<th >M&#227; T&#224;i kho&#7843;n</th>
		<th >T&#234;n T&#224;i kho&#7843;n</th>
		<th >Tiểu khoản</th>
		<th >TK mẹ</th>

		<th align="right">{translate key="common.action"}</th>
	</tr>

	
{assign var="dong" value="0"}
{assign var="stt" value="0"}
{iterate from=dmtks item=dmtk name=dmtks}
	{assign var = "matk" value = $dmtk->getmatk()}
	{assign var = "tentk" value = $dmtk->gettentk()|escape}
	{assign var = "tentk" value = $dmtk->gettentk()|escape}
	{assign var="dong" value=$dong+1}


	{if $stt ==0}
		{assign var="stt" value="1"}
		<tr valign="top" >
			<td class="drag">
			{$dmtk->getmatk()|escape}</td>
			<td class="drag">{$dmtk->gettentk()|escape}</td>
			<td class="drag"  align="center">
			<input type="checkbox" class = "value" name="tieu_khoan" {if $dmtk->gettieu_khoan()}checked="checked" value="1" {else} value="0"  {/if} disabled="disabled" />
			</td>
			<td class="drag">{$dmtk->gettk_me()|escape}
			{if $dmtk->getngoaibang()}
			<input type="checkbox" class = "value" name="ngoaibang" checked="checked" value="1" disabled="disabled" />TK ngoài bảng
			{/if}

			</td>


			<td align="right" class="nowrap">
				<a href="#" class="action" id ={$dong} onclick="edit('{$matk}', '{$tentk}', this.id)">{translate key="common.edit"}</a>&nbsp;|&nbsp;<a href="{url op="deleteDMTK" path=$dmtk->getmatk()}" onclick="return confirm('Xoa Tai Khoan {$matk}')" class="action">{translate key="common.delete"}</a>
			</td>
		</tr>
	{else}
		{assign var="stt" value="0"}
		<tr valign="top" class="alt">
			<td class="drag">{$dmtk->getmatk()|escape}</td>
			<td class="drag">{$tentk}</td>
			<td class="drag" align="center">
			<input type="checkbox" class = "value"  name="tieu_khoan" {if $dmtk->gettieu_khoan()}checked="checked" {/if}  value="1" disabled="disabled" /> </td>
			<td class="drag">{$dmtk->gettk_me()|escape}
			{if $dmtk->getngoaibang()}
			<input type="checkbox" class = "value" name="ngoaibang" checked="checked" value="1" disabled="disabled" />TK ngoài bảng
			{/if}

			</td>

			<td align="right" class="nowrap">
				<a href="#" class="action" id ={$dong} onclick="edit('{$matk}', '{$tentk}', this.id)">{translate key="common.edit"}</a>&nbsp;|&nbsp;<a href="{url op="deleteDMTK" path=$dmtk->getmatk()}" onclick="return confirm('Xoa Tai Khoan {$matk}')" class="action">{translate key="common.delete"}</a>
			</td>
		</tr>
	{/if}
{/iterate}

<tr>
	<td colspan="{$socot}" class="endseparator">&nbsp;</td>
</tr>

</table>
</div>

{include file="common/footer.tpl"}

